package com.wnxy.mapper;

import com.wnxy.pojo.Article;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ArticleMapper {
    List<Article> findAll();

    @Insert("INSERT INTO article(userid,title,createtime,content)" +
            "VALUES(#{user.id},#{title},#{createtime},#{content})")
    void add(Article article);

    @Update("update article set userid=#{user.id},title=#{title}," +
            "createtime=#{createtime},content=#{content} where id=#{id}")
    void update(Article article);

    @Delete("delete from article where id=#{id}")
    void delete(Integer id);
}
